package com.dhcc.bpm.modules.cost.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dhcc.bpm.modules.cost.entity.CostRule;
import com.dhcc.bpm.modules.cost.mapper.CostRuleMapper;
import com.dhcc.bpm.modules.cost.service.ICostRuleService;
import com.dhcc.bpm.modules.cost.vo.CostRuleVO;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.validation.constraints.NotEmpty;
import java.util.List;

/**
 * @ClassName CostRuleServiceImpl.class
 * @Description   收费规则表服务实现类
 * @Author xiaFaYu
 * @Date 2019-12-16 14:16
 * @Version V1.0
 * @Copyright: 2020 东华软件 . All rights reserved.
 */
@Service
public class CostRuleServiceImpl extends BaseServiceImpl<CostRuleMapper, CostRule> implements ICostRuleService {
	@Autowired
	private CostRuleMapper costRuleMapper;

	/**
	 * @Description 自定义分页
	 * @Author xiafayu
	 * @Date 2020/2/24 15:10
	 * @param page
	 * @param costRule
	 * @return com.baomidou.mybatisplus.core.metadata.IPage<com.dhcc.bpm.modules.cost.vo.CostRuleVO>
	 **/
	@Override
	public IPage<CostRuleVO> selectCostRulePage(IPage<CostRuleVO> page, CostRuleVO costRule) {
		return page.setRecords(baseMapper.selectCostRulePage(page, costRule));
	}

	/**
	 * @Description 查询
	 * @Author xiafayu
	 * @Date 2020/2/24 15:10
	 * @param productId
	 * @return com.dhcc.bpm.modules.cost.vo.CostRuleVO
	 **/
	@Override
	public CostRuleVO getByProductId(Long productId) {
		return costRuleMapper.selectByProductId(productId);
	}

	/**
	 * @Description 查询
	 * @Author xiafayu
	 * @Date 2020/2/24 15:10
	 * @param apiId
	 * @return com.dhcc.bpm.modules.cost.vo.CostRuleVO
	 **/
	@Override
	public CostRuleVO getByApiId(Long apiId) {
		return costRuleMapper.selectByApiId(apiId);
	}

	/**
	 * @Description 更新状态
	 * @Author xiafayu
	 * @Date 2020/2/24 15:11
	 * @param
	 * @return boolean
	 **/
	@Override
	public boolean updateRefreshStatus() {
		return costRuleMapper.updateRefreshStatus();
	}

	/**
	 * @Description 查询
	 * @Author xiafayu
	 * @Date 2020/2/24 15:11
	 * @param ids
	 * @return java.util.List<com.dhcc.bpm.modules.cost.vo.CostRuleVO>
	 **/
	@Override
	public List<CostRuleVO> getListByIds(@NotEmpty List<Long> ids) {
		return costRuleMapper.getListByIds(ids);
	}
}
